package io.github.zhaocy;

import io.github.zhaocy.config.MyProperties;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.bind.Bindable;
import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.context.ApplicationContext;

import java.util.List;

@SpringBootApplication
public class Application {

	public static void main(String[] args) {
		ApplicationContext context = SpringApplication.run(Application.class, args);

		Binder binder = Binder.get(context.getEnvironment());

		//简单配置
		MyProperties properties = binder.bind("io.github.zhaocy", Bindable.of(MyProperties.class)).get();
		System.out.println(properties.getName());

		//绑定List
		List<String> urls = binder.bind("io.github.zhaocy.url", Bindable.listOf(String.class)).get();
		System.out.println(urls);


	}
}
